package trism.game.controller {
	import trism.game.GameScreen;
	import flash.events.Event;
	import trism.game.controller.init.GameInitController;
	import trism.game.model.GameModel;

	/**
	 * @author Samoiloff  http://samoiloff.com/
	 */
	public class GameController extends GameBaseController {
		
		private var _screen	: GameScreenController;
		private var _init	: GameInitController;
		
		public function GameController(model : GameModel) {
			super(model);
			
//			trace("GameController.GameController() : ");
			
			_init = new GameInitController(_model);
			
			
			if (_model.initialized) {
				onInitialized();
			} else {
				_model.addEventListener(GameModel.INITIALIZED_CHANGED, onInitialized);
			}
			
		}

		private function onInitialized(event : Event = null) : void {
			_screen = new GameScreenController(_model);
			
			
			
			_model.commonItem.dynamicItem.screen = GameScreen.FIELD;
		}
	}
}
